﻿using System;
using Gp.Scripts.Core;
using QFramework;
using UnityEngine;

/// 用于获取功能型组件的工具类
public static class Global
{
    public static T Get<T>() where T : class, IStructure
    {
        return MainArchitecture.Interface.Get<T>();
    }


    public static void SendEvent<T>() where T : new()
    {
        MainArchitecture.Interface.SendEvent<T>();
    }

    public static void SendEvent<T>(T args)
    {
        MainArchitecture.Interface.SendEvent(args);
    }


    public static IUnRegister RegisterEvent<T>(Action<T> action)
    {
        return MainArchitecture.Interface.RegisterEvent<T>(action);
    }

    public static T GetConfig<T>() where T : class, IConfigTable
    {
        return ExcelTableManager.Instance.GetByType<T>();
    }


    public static T GetSceneRoot<T>() where T : SettleNodeRoot
    {
        return SceneRoot.Get<T>();
    }
}